﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;

namespace P5.OpenIdEx
{
    public sealed class OpenIdProviders
    {
        public const string SESSION_ACCOUNT_INFO = "SessionOpenIdAccountInfo";
        public const string GOOGLE = "google";
        public const string GOOGLE_IDENTIFIER = "https://www.google.com/accounts/o8/id";
        public const string YAHOO = "yahoo";
        public const string YAHOO_IDENTIFIER = "https://me.yahoo.com";
        public const string MYOPENID = "myopenid";
        public const string MYOPENID_IDENTIFIER = "http://myopenid.com";

        public static FetchRequest GetFetchRequest(bool useDetails)
        {
            FetchRequest fetchRequest = new FetchRequest();
            fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
            fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.FullName);

            if (useDetails)
            {
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.BirthDate.DayOfMonth);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.BirthDate.Month);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.BirthDate.WholeBirthDate);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.BirthDate.Year);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.HomeAddress.City);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.HomeAddress.Country);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.HomeAddress.PostalCode);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.IM.AOL);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.IM.ICQ);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.IM.Jabber);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.IM.MSN);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.IM.Skype);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.IM.Yahoo);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Phone.Fax);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Phone.Home);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Phone.Mobile);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Phone.Work);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Web.Flickr);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Web.Homepage);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Web.LinkedIn);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Media.Images.Default);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.First);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Last);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Middle);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Prefix);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Suffix);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Person.Gender);
                fetchRequest.Attributes.AddRequired(WellKnownAttributes.Person.Biography);
            }

            return fetchRequest;
        }
    }
}
